home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / General / MM3Tp.sea Folder / Made by Marksman / Sources / u / My_basic_window.p < prev    next >
Text File  |  1994-01-16  |  8KB  |  344 lines

  1.  
  2. unit UMy_basic_window;
  3. {  My_basic_window                                 Handle this Window }
  4. {  Copyright © 1994 George R. Cossey }
  5.  
  6.     File name: My_basic_window
  7.     Function: Handle a Window 
  8.     History: 1/16/94 Original by George Cossey
  9.  
  10. }
  11.  
  12. interface
  13.  
  14.     uses
  15.         Printing,Folders,Sound,mmCommonMM_Demo,CommonMM_Demo;
  16.  
  17.  
  18. { ======================================================= }
  19. { ======================================================= }
  20.  
  21. procedure U_InitMy_basic_windowRec(theWS:My_basic_windowPRec);
  22.  
  23. { Initialize us so all our routines can be activated }
  24. procedure U_InitMy_basic_window;
  25.  
  26. { Close our window }
  27. procedure U_CloseMy_basic_window(theWS:My_basic_windowPRec);
  28.  
  29. { Handle resizing scrollbars }
  30. procedure U_ResizedMy_basic_window(theWS:My_basic_windowPRec;OldRect:Rect);
  31.  
  32. { Our window was moved }
  33. procedure U_MovedMy_basic_window(OldRect:Rect;whichWindow:WindowPtr);
  34.  
  35. { Update our window, someone uncovered a part of us }
  36. procedure U_UpdateMy_basic_window(theWS:My_basic_windowPRec);
  37.  
  38. { Open our window and draw everything }
  39. procedure U_OpenMy_basic_window(theWS:My_basic_windowPRec);
  40.  
  41. { Handle activation of our window }
  42. procedure U_ActivateMy_basic_window(theWS:My_basic_windowPRec;Do_An_Activate:Boolean);
  43.  
  44. { Handle action to our window, like controls }
  45. procedure U_DoButtonMy_basic_window(theWS:My_basic_windowPRec;RefCon:longint;theControl:ControlHandle;var UnHiliteValue:integer);
  46.  
  47. { Handle a checkbox being pressed }
  48. procedure U_DoCheckboxMy_basic_window(theWS:My_basic_windowPRec;theControl:ControlHandle;var NewValue:integer);
  49.  
  50. { Allow for special handling of scrollbars }
  51. procedure U_ScrollMy_basic_window(theWS:My_basic_windowPRec;var RefCon:longint;code:integer;myPt:Point);
  52.  
  53. { Handle any special window events }
  54. procedure U_DoEventMy_basic_window(theWS:My_basic_windowPRec;var myEvent:EventRecord);
  55.  
  56. { ======================================================= }
  57. { ======================================================= }
  58.  
  59. implementation
  60.  
  61. { ======================================================= }
  62. { ======================================================= }
  63.  
  64. procedure U_InitMy_basic_windowRec(theWS:My_basic_windowPRec);
  65.  
  66.  
  67. begin
  68. end;
  69.  
  70. { ======================================================= }
  71.  
  72. { Routine: U_InitMy_basic_window }
  73. { Purpose: Initialize our window data to not in use yet }
  74.  
  75. procedure U_InitMy_basic_window;
  76.  
  77.  
  78. begin
  79. end;
  80.  
  81. { ======================================================= }
  82.  
  83. { Routine: U_CloseMy_basic_window }
  84. { Purpose: Close out the window }
  85.  
  86. procedure U_CloseMy_basic_window(theWS:My_basic_windowPRec);
  87.  
  88.  
  89. begin
  90. end;
  91.  
  92. { ======================================================= }
  93.  
  94. { Routine: U_ResizedMy_basic_window }
  95. { Purpose: We were resized or zoomed, update the scrolling scrollbars }
  96. { OldRect is the size of the window before the resize }
  97.  
  98. procedure U_ResizedMy_basic_window(theWS:My_basic_windowPRec;OldRect:Rect);
  99.  
  100.  
  101. begin
  102. end;
  103.  
  104. { ======================================================= }
  105.  
  106. { Routine: U_MovedMy_basic_window }
  107. { Purpose: We were moved, possibly to another screen and screen depth }
  108. { OldRect is the size of the window before the resize }
  109.  
  110. procedure U_MovedMy_basic_window(OldRect:Rect;whichWindow:WindowPtr);
  111.  
  112.  
  113. begin
  114. end;
  115.  
  116. { ======================================================= }
  117.  
  118. { Routine: U_UpDateMy_basic_window }
  119. { Purpose: Update our window }
  120. { User can place code before or after the DrawControls }
  121.  
  122. procedure U_UpdateMy_basic_window(theWS:My_basic_windowPRec);
  123.  
  124.  
  125. begin
  126. DrawControls(theWS^.theWindow);                        { Draw all the controls }
  127. end;
  128.  
  129. { ======================================================= }
  130.  
  131. { Routine: U_OpenMy_basic_window }
  132. { Purpose: Open our window }
  133.  
  134. procedure U_OpenMy_basic_window(theWS:My_basic_windowPRec);
  135.  
  136.  
  137. begin
  138.  
  139. if ((theWS <> nil) and (theWS^.theWindow <> nil)) then    {  See if opened OK }
  140.     begin
  141.     end;
  142. end;
  143.  
  144. { ======================================================= }
  145.  
  146. { Routine: U_ActivateMy_basic_window }
  147. { Purpose: We activated or deactivated }
  148.  
  149. procedure U_ActivateMy_basic_window(theWS:My_basic_windowPRec;Do_An_Activate:Boolean);
  150.  
  151.  
  152. begin
  153. if (Do_An_Activate) then                                { Handle the activate }
  154.     begin
  155.     end
  156. else
  157.     begin
  158.     end;
  159. end;
  160.  
  161. { ======================================================= }
  162.  
  163. { Routine: U_DoButtonMy_basic_window }
  164. { Purpose: Handle extra buttons in our window }
  165.  
  166. {      RefCon = The RefCon of the button that was pressed }
  167. {      theControl = The ControlHandle of the button that was pressed }
  168. {      UnHiliteValue = 0 for unhilite, we can change that }
  169. procedure U_DoButtonMy_basic_window(theWS:My_basic_windowPRec;RefCon:longint;theControl:ControlHandle;var UnHiliteValue:integer);
  170. var
  171.     theSelection:integer;                                { For palette and popup selections }
  172.  
  173.  
  174. begin
  175. case (RefCon) of                                    { Select correct button }
  176.     -1:begin end;
  177.     ResC_Button:                { Button, Button  }
  178.         begin
  179.         end;
  180.  
  181.     ResC_Icon:                { Icon button, Icon  }
  182.         begin
  183.         end;
  184.  
  185.     ResC_Sicn:                { Sicn button, Sicn  }
  186.         begin
  187.         end;
  188.  
  189.     ResC_Picture:                { Picture button, Picture  }
  190.         begin
  191.         end;
  192.  
  193.     ResC_Rect_hotspot2:                { HotSpot, Rect hotspot2  }
  194.         begin
  195.         end;
  196.  
  197.     ResC_Tool_palette:                { Palette, Tool palette  }
  198.         begin
  199.         theSelection := GetCtlValue(theWS^.Ctrl_Tool_palette);{ Get the palette value, 0xrrcc, rr is row, cc is column }
  200.         theWS^.Value_Tool_palette := theSelection;    { Get the palette value }
  201.         case (theSelection)    of                { Select correct item }
  202.             -1:begin end;
  203.             257:            {  Row 1, Column 1 }
  204.                 begin
  205.                 end;
  206.             258:            {  Row 1, Column 2 }
  207.                 begin
  208.                 end;
  209.             513:            {  Row 2, Column 1 }
  210.                 begin
  211.                 end;
  212.             514:            {  Row 2, Column 2 }
  213.                 begin
  214.                 end;
  215.             769:            {  Row 3, Column 1 }
  216.                 begin
  217.                 end;
  218.             770:            {  Row 3, Column 2 }
  219.                 begin
  220.                 end;
  221.             1025:            {  Row 4, Column 1 }
  222.                 begin
  223.                 end;
  224.             1026:            {  Row 4, Column 2 }
  225.                 begin
  226.                 end;
  227.             1281:            {  Row 5, Column 1 }
  228.                 begin
  229.                 end;
  230.             1282:            {  Row 5, Column 2 }
  231.                 begin
  232.                 end;
  233.             1537:            {  Row 6, Column 1 }
  234.                 begin
  235.                 end;
  236.             1538:            {  Row 6, Column 2 }
  237.                 begin
  238.                 end;
  239.             1793:            {  Row 7, Column 1 }
  240.                 begin
  241.                 end;
  242.             1794:            {  Row 7, Column 2 }
  243.                 begin
  244.                 end;
  245.             2049:            {  Row 8, Column 1 }
  246.                 begin
  247.                 end;
  248.             2050:            {  Row 8, Column 2 }
  249.                 begin
  250.                 end;
  251.             2305:            {  Row 9, Column 1 }
  252.                 begin
  253.                 end;
  254.             2306:            {  Row 9, Column 2 }
  255.                 begin
  256.                 end;
  257.             2561:            {  Row 10, Column 1 }
  258.                 begin
  259.                 end;
  260.             2562:            {  Row 10, Column 2 }
  261.                 begin
  262.                 end;
  263.  
  264.             otherwise                            { allow other buttons, trap for debug }
  265.                 begin
  266.                 end;
  267.             end;                                    { end of switch }
  268.         end;
  269.  
  270.  
  271.     otherwise                                    { allow other buttons, trap for debug }
  272.         begin
  273.         end;
  274.     end;                                            { end of switch }
  275.  
  276. end;
  277.  
  278. { ======================================================= }
  279.  
  280. { Routine: U_DoCheckBoxMy_basic_window }
  281. { Purpose: Handle ckboxes and radios in our window }
  282.  
  283. procedure U_DoCheckboxMy_basic_window(theWS:My_basic_windowPRec;theControl:ControlHandle;var NewValue:integer);
  284. var
  285.     RefCon:longint;                                    { RefCon for controls }
  286.  
  287.  
  288. begin
  289. RefCon := GetCRefCon(theControl);                { get control refcon }
  290.  
  291. case (RefCon) of                                    { Select correct button }
  292.     -1:begin end;
  293.     ResC_Checkbox:                { Checkbox, Checkbox  }
  294.         begin
  295.         end;
  296.  
  297.  
  298.     otherwise                                    { allow other buttons, trap for debug }
  299.         begin
  300.         end;
  301.     end;                                            { end of switch }
  302. end;
  303.  
  304. { ======================================================= }
  305.  
  306. { Routine: U_ScrollMy_basic_window }
  307. { Purpose: Special handling of scrollbars }
  308. { Return RefCon as 0 to inhibit standard routine from handling it }
  309.  
  310. procedure U_ScrollMy_basic_window(theWS:My_basic_windowPRec;var RefCon:longint;code:integer;myPt:Point);
  311.  
  312.  
  313. begin
  314. case (RefCon) of                            { Select correct button }
  315.     -1:begin end;
  316.     ResC_Scroll_bar:                { ScrollBar, Scroll bar  }
  317.         begin
  318.         { HandleWScrollBar(myPt,code,1,10,theControl);     x   code,Inc,PageInc,handle   x   }
  319.         theWS^.Value_Scroll_bar := GetCtlValue(theWS^.Ctrl_Scroll_bar);{ Get the scrollbar value }
  320.         end;
  321.  
  322.  
  323.     otherwise                                    { allow other buttons, trap for debug }
  324.         begin
  325.         end;
  326.     end;                                            { end of switch }
  327. end;
  328.  
  329. { ======================================================= }
  330.  
  331. { Routine: U_DoEventMy_basic_window }
  332. { Purpose: Handle any special window events }
  333.  
  334. procedure U_DoEventMy_basic_window(theWS:My_basic_windowPRec;var myEvent:EventRecord);
  335.  
  336.  
  337. begin
  338. end;
  339.  
  340. { ======================================================= }
  341. { ======================================================= }
  342. end.
  343.